package com.springboot.cloud.demos.feign.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.demos.entity.param.CouponQueryParam;
import com.springboot.cloud.demos.feign.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class CouponController extends BaseController {

    @Autowired
    private CouponService couponService;

    @RequestMapping(value = "/coupon", method = RequestMethod.GET)
    public Result getCoupon() {
        CouponQueryParam param = new CouponQueryParam();
        param.setValidStartTime(new Date());
        param.setValidEndTime(new Date());
        return couponService.conditions(param);
    }
}
